require(["common", "coAjax", "queryString", "hash_routie", "routie"], function(jSouper, coAjax, QueryString, hash_routie, routie) {
    //放置监听HASH变动
    hash_routie.on("classify", function() {

        // 加载标签列表
        coAjax.get(appConfig.bus.tags_detail, {
            bus_id: appConfig.bus_id
        }, function(result) {
            App.set("$Cache.tags_detail", result.result);
            _init_hash();
        });
    })

    function _init_hash() {
        var queryString = new QueryString(location.hash);
        var tag_id = queryString.get("tag_id");

        var tags_detail = App.get("$Cache.tags_detail");
        for (var i = 0, tag; tag = tags_detail[i]; i += 1) {
            if (tag._id == tag_id) {
                App.set("$Cache.pointer_tag", tag);
                break;
            }
        }
        if (i == tags_detail.length) {
            App.set("$Cache.pointer_tag", tags_detail[0]);
        }
    }

});
